home *** CD-ROM | disk | FTP | other *** search
- property spriteNum, motion, location, row
- global tableau, getlist, equal, currentsel, godlist, foundation, points, stock
-
- on beginSprite me
- if not listp(tableau) then
- tableau = [:]
- end if
- row = determinerow()
- if not objectp(tableau[row]) then
- tableau.addProp(row, new(script("card pile")))
- end if
- if tableau[row].getcardcount() < 1 then
- sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
- stock.cards.deleteAt(1)
- tableau[row].addCard(spriteNum)
- end if
- location = sprite(spriteNum).loc
- end
-
- on mouseDown me
- if tableau[row].getcardcount() > 0 then
- if spriteNum = tableau[row].getlastcard().spnum then
- puppetSound(3, member("pick card", "100GPak Generic SFX"))
- sprite(spriteNum).locZ = spriteNum + 1000
- getlist = tableau[row]
- motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
- end if
- if sprite(spriteNum).member = member("empty", "playing cards") then
- sendSprite(spriteNum - 1, #mouseDown)
- end if
- end if
- end
-
- on moving me
- if the mouseDown then
- sprite(spriteNum).loc = the mouseLoc
- else
- if the mouseUp then
- sprite(spriteNum).locZ = spriteNum
- motion.forget()
- abort()
- end if
- end if
- end
-
- on mouseUp me
- if equal then
- puppetSound(3, member("pick card", "100GPak Generic SFX"))
- sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
- sprite(spriteNum).member = member("empty", "playing cards")
- godlist.addCard(currentsel)
- sprite(spriteNum).loc = location
- tableau[row].cards.deleteOne(tableau[row].getlastcard())
- if objectp(foundation[sprite(currentsel).row]) then
- points = points + 10
- end if
- equal = 0
- currentsel = 0
- godlist = VOID
- getlist = VOID
- repeat with i = 87 to 90
- if tableau[sprite(i).row].getcardcount() = 0 then
- next repeat
- end if
- sprite(i).loc = tableau[sprite(i).row].getlastcard().location
- end repeat
- checkwin()
- else
- if not equal then
- if sprite(spriteNum).member.name <> "empty" then
- puppetSound(3, member("drop card", "100GPak Generic SFX"))
- getlist = VOID
- sprite(spriteNum).loc = location
- end if
- end if
- end if
- checkwin()
- end
-
- on determinerow me
- if (spriteNum >= 31) and (spriteNum <= 44) then
- return #one
- else
- if (spriteNum >= 45) and (spriteNum <= 58) then
- return #two
- else
- if (spriteNum >= 59) and (spriteNum <= 72) then
- return #three
- else
- if (spriteNum >= 73) and (spriteNum <= 86) then
- return #four
- end if
- end if
- end if
- end if
- end
-